/*
 * @Author: zhang gen yuan
 * @Date: 2021-05-07 16:27:41
 * @Descripttion: 
 */
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router';
import routes from './routes';
import store from './../store/index';

const Router = createRouter({
  history: createWebHistory(),
  routes
})

Router.beforeEach((to,from,next)=>{
  if(to.path === '/login'){
    next()
  }else{
    if(store.getters['user/getToken']){
      next()
    }else{
      next('login')
    }
  }
})

export default Router
